<?php
namespace Admin\Controller;
use Think\Controller;
class AjaxController extends Controller {

        public function getspec(){
            $id = I('get.id');

            // 根据传过来的类型id去查询对应的规格项
            $spec = D('goods_spec')->relation('goods_spec_attr')->where("goods_type_id=$id")->select();
            $this->ajaxReturn($spec);
        }

        public function specinsert(){
                //先判断是否有数据缓存了
                if(s('spec_attr')){

                    // print_r(s('spec_attr'));die;
                    $spec_attr=s('spec_attr');

                    $spec_attr[I('post.spec_rule')]=I('post.');

                }else{

                    // $spec_attr=array();
                    // print_r(I('post.'));die;
                    $spec_attr[I('post.spec_rule')]=I('post.');

                }
                 s('spec_attr',$spec_attr);

            //返回缓存的数据
            $this->ajaxReturn(s('spec_attr'));
        }

}